home *** CD-ROM | disk | FTP | other *** search
/ JCSM Shareware Collection 1996 September / JCSM Shareware Collection (JCS Distribution) (September 1996).ISO / prgtools / pbvl010.zip / WINDEMO6.BAS < prev    next >
BASIC Source File  |  1994-02-10  |  4KB  |  107 lines

  1. '┌─────────────────────────────────────────────────────────────────────────┐
  2. '│    FILE: WINDEMO6.BAS                                                   │
  3. '│ PURPOSE: PB/VISION(tm) LITE Example Program                             │
  4. '├─────────────────────────────────────────────────────────────────────────┤
  5. '│ For instant help on any PB/VISION(tm) keyword, place the cursor on that │
  6. '│ keyword and press <CTRL-F1>.  The PB/VISION(tm) index can be accessed   │
  7. '│ by pressing <SHIFT-F1> twice.  The file "PBVLITE.PBH" _must_ be in the  │
  8. '│ same directory as the PowerBASIC IDE (PB.EXE) for this feature to work  │
  9. '│ properly.                                                               │
  10. '└─────────────────────────────────────────────────────────────────────────┘
  11.  
  12. '       ==================================================
  13. '       BE SURE TO RUN "DEMO.EXE" FOR INFORMATION ON OTHER
  14. '       PowerBASIC 3.0 TOOLS FROM DSE SOFTWARE PUBLISHING.
  15. '       ==================================================
  16.  
  17. %ISPBU = 0
  18.  
  19. %cmNextWindow = 1001
  20. %cmCloseWindow = 1002
  21.  
  22. $INCLUDE ".\WINDOW.BI"
  23. $INCLUDE ".\MOUSE.BI"
  24. $INCLUDE ".\EVENT.BI"
  25.  
  26.     DEFINT A-Z
  27.     $DYNAMIC
  28.  
  29.     DIM CtrlBox AS MENUCOLORTYPE        ' for the window control box
  30.  
  31.     APP.GraphicsMode = 1            ' enable graphics mapping
  32.         APP.GraphicsMouse = 1            ' enabled graphics mouse
  33.  
  34.     APPTITLE &HCF, "WINDEMO1.BAS - A PB/VISION(tm) LITE DEMO - PRESS <ESC> TO QUIT"
  35.  
  36.         APPINIT                 ' initialize the desktop
  37.  
  38.     GottaMouse% = MOUSEINIT(buttons%)    ' initialize the rodent
  39.     MOUSECURSORON                ' make it visible
  40.  
  41.     ' assign window flags to a single variable to make code easier to read
  42.  
  43.     myWinFlags = %DRAGBAR OR %SHADOW OR %CONTROL OR %RESIZE OR %MINMAX
  44.  
  45.         ' open a bunch of windows
  46.  
  47.     A = WINOPEN (15, 40, &H9F, 1, &H9F, "WINDOW A", &H8F, %VSCROLLBAR OR %HSCROLLBAR OR %DRAGBAR)
  48.     B = WINOPEN (10, 40, &HA7, 1, &HA8, "WINDOW B", &HCF, myWinFlags)
  49.     C = WINOPEN (10, 40, &HF1, 1, &HF1, "WINDOW C", &H8F, myWinFlags)
  50.     D = WINOPEN (10, 40, &HCF, 1, &HCF, "WINDOW EVENT", &HB0, %DRAGBAR OR %SHADOW)
  51.  
  52.     ' add title and slightly modify the DOS output window
  53.  
  54.     WINTITLE 1, &HE0, "DOS WINDOW (HANDLE = 1)"
  55.     WINMODIFY 1, -1, -1, -1, -1, %DRAGBAR OR %SHADOW
  56.  
  57.     WINSHOW 1, 11, 36, 10, 40        ' display DOS window
  58.     WINSHOW A, 5, 5, 20, 40            ' display all of the rest
  59.     WINSHOW B, 8, 25, 10, 30
  60.     WINSHOW C, 5, 40, 10, 30
  61.     WINSHOW D, 2, 2, 10, 40
  62.  
  63.     HOTKEYADD &H6100, %cmCloseWindow        ' trap CTRL-F4
  64.     HOTKEYADD &H4000, %cmNextWindow
  65.  
  66.     DO
  67.         eventNo = GetEvent(0)
  68.  
  69.         SELECT CASE eventNo
  70.  
  71.                     CASE 0            ' filter out 'null' events
  72.             CASE 17            ' filter out clock ticks
  73.  
  74.             CASE 102        ' detect <ESC> key
  75.                 EXIT LOOP    ' exit this routine
  76.  
  77.             CASE 108, 203        ' window control box click
  78.                 CtrlBox.kolor = &HDADF        ' define WINCTRLBOX window
  79.                 CtrlBox.borderattr = &HDF
  80.                 CtrlBox.titleattr = &H8F
  81.                 CtrlBox.highlight = &HF4F0
  82.                 CtrlBox.sepbar = &HD0
  83.                 CtrlBox.border = 1
  84.                 CtrlBox.Flags = %CONTROL OR %SHADOW
  85.  
  86.                             WINCTRLBOX WINGET, CtrlBox
  87.  
  88.             CASE 208, 211        ' scroll bar events
  89.                 WINSCROLLBARGET WINGET, VPOS, HPOS
  90.                 WINWRITELN WINGET, "Horizontal =" + STR$(HPOS) + "%, Vertical =" + STR$(VPOS%) + "%"
  91.  
  92.                         CASE %cmCloseWindow    ' CTRL-F4 pressed
  93.                 WINCLOSE WINGET
  94.  
  95.             CASE %cmNextWindow    ' F6 pressed
  96.                 WINNEXT
  97.  
  98.             CASE ELSE        ' any other event
  99.                 WINWRITELN D, "Event" + STR$(eventNo) + " in window handle" + STR$(WINGET)
  100.  
  101.         END SELECT
  102.     LOOP
  103.  
  104.     MOUSECURSOROFF                ' hide the rodent
  105.     APPCLOSE                ' close the desktop
  106.     END                    ' end the program
  107.